package com.javabi.common.collect.indexmap;

import java.util.ListIterator;

class ImmutableListIterator<V> implements ListIterator<V> {

	private int index = -1;
	private final V[] array;

	public ImmutableListIterator(V[] array) {
		this.array = array;
	}

	@Override
	public boolean hasNext() {
		index++;
		while (index < array.length) {
			if (array[index] != null) {
				return true;
			}
			index++;
		}
		return false;
	}

	@Override
	public V next() {
		return array[index];
	}

	@Override
	public void remove() {
		throw new UnsupportedOperationException();
	}

	@Override
	public boolean hasPrevious() {
		throw new UnsupportedOperationException();
	}

	@Override
	public V previous() {
		throw new UnsupportedOperationException();
	}

	@Override
	public int nextIndex() {
		throw new UnsupportedOperationException();
	}

	@Override
	public int previousIndex() {
		throw new UnsupportedOperationException();
	}

	@Override
	public void set(V e) {
		throw new UnsupportedOperationException();
	}

	@Override
	public void add(V e) {
		throw new UnsupportedOperationException();
	}

}
